package com.jrx.anytxn.customer.mapper.ext;

import com.jrx.anytxn.customer.entity.TlCouponDetail;
import com.jrx.anytxn.customer.mapper.base.TlCouponDetailMapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;


/**
 * 优惠券发放明细mapper扩展
 */
public interface ExtTlCouponDetailMapper extends TlCouponDetailMapper {

    /**
     * 根据条件分页查询优惠券发放明细信息
     * @param tenantId
     * @param chineseName
     * @param customerId
     * @param idNumber
     * @param updateBy
     * @param mobile
     * @param beginDate
     * @param endDate
     * @param pageCount
     * @param pageSize
     * @return
     */
    List<TlCouponDetail> selectAllByPageAndTenId(@Param("tenantId") String tenantId, @Param("chineseName") String chineseName,
                                                 @Param("customerId") String customerId, @Param("idNumber") String idNumber,
                                                 @Param("updateBy") String updateBy, @Param("mobile") String mobile,
                                                 @Param("beginDate") String beginDate, @Param("endDate") String endDate,
                                                 @Param("pageCount") Integer pageCount, @Param("pageSize") Integer pageSize);


    /**
     * 获取总条数
     * @param tenantId
     * @param chineseName
     * @param customerId
     * @param idNumber
     * @param updateBy
     * @param mobile
     * @param beginDate
     * @param endDate
     * @return
     */
    int selectCount(@Param("tenantId") String tenantId, @Param("chineseName") String chineseName,
                    @Param("customerId") String customerId,@Param("idNumber") String idNumber,
                    @Param("updateBy") String updateBy, @Param("mobile") String mobile,
                    @Param("beginDate") String beginDate, @Param("endDate") String endDate);

    int batchInsert(List<TlCouponDetail> tlCouponDetailList);

    /**
     *
     * @param customerId
     * @param activityId
     * @param rightsId
     * @param tenantId
     * @return
     */
    List<TlCouponDetail> selectByCustomerIdAndActivityIdAndRightsId(String customerId, String activityId, String rightsId,
                                                              String tenantId);

    /**
     *
     * @param customerId
     * @param activityId
     * @param rightsId
     * @param tenantId
     * @param startTime
     * @param endTime
     * @return
     */
    List<TlCouponDetail> selectByCustomerIdAndActivityIdAndRightsIdWithPeriod(String customerId, String activityId, String rightsId,
                                                                    String tenantId, String startTime, String endTime);

    List<TlCouponDetail> selectByCustomerIdAndActivityIdWithPeriod(String customerId, String activityId, String tenantId, Date startTime, Date endTime);

    /**
     *
     * @param customerId
     * @param activityId
     * @param rightsId
     * @param tenantId
     * @param startTime
     * @param endTime
     * @return
     */
    List<TlCouponDetail> selectByCustomerIdAndRightsIdWithPeriod(String customerId, String activityId, String rightsId,
                                                                              String tenantId, String startTime, String endTime);


    List<TlCouponDetail> selectByCustomerIdAndActivityIdAndRightsIdAndRightsType(String customerId, String activityId, String rightsId,
                                                              String tenantId,String rightsType);


    List<TlCouponDetail> selectByMobileAndActivityIdAndRecommendedNonNull(String customerId, String activityId,
                                                                            String tenantId);
}
